import type { MedicineOrderDetail, MedicineOrderPre, PostPatientMedicineOrderParams } from '@/types/medicine'
import { request } from '@/utils/request'

/**
 * 获取药品预支付信息
 * @param id 处方ID
 * @returns
 */
export const getPatientMedicineOrderPreAPI = (id: string) => {
	return request<MedicineOrderPre>('/patient/medicine/order/pre', 'GET', {
		prescriptionId: id
	})
}

/**
 * 提交药品订单
 * @param data 提交药品订单参数
 * @returns 订单ID
 */
export const postPatientMedicineOrderAPI = (data: PostPatientMedicineOrderParams) => {
	return request<{ id: string }>('/patient/medicine/order', 'POST', data)
}
/**
 * 获取药品订单详情
 * @param id 订单ID
 * @returns
 */
export const getPatientMedicineOrderDetailAPI = (id: string) => {
  return request<MedicineOrderDetail>(`/patient/medicine/order/detail/${id}`, 'GET')
}